import { createSlice } from "@reduxjs/toolkit";
import { Button, Space, Toast } from "antd-mobile";
export const UserList = createSlice({
  name: "UserList",
  initialState: {
    userpope: [
      {
        id: 1,
        name: "小美",
        code: "1213231213321",
        phoone:'1132311212'
      },
      {
        id: 2,
        name: "小明",
        code: "1213231213321",
        phoone:'1132311212'
      },
      {
        id: 3,
        name: "小张",
        code: "1213231213321",
        phoone:'1132311212'
      },
      {
        id: 4,
        name: "小王",
        code: "1213231213321",
        phoone:'1132311212'
      },
    ],
  },
  reducers: {
    addpope(state, { payload }) {
      state.userpope.find((item) => item.id == payload.id);
      state.userpope.push(payload);
      Toast.show({
        icon: "success",
        content: "新增成功",
      });
    },
  },
});
// 每个 case reducer 函数会生成对应的 Action creators
export const { addpope } = UserList.actions;

export default UserList.reducer;
